package com.fanfanwang.ffw.app.ui.service;

import java.util.ArrayList;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;

import com.fanfanwang.ffw.app.AppConstant;
import com.fanfanwang.ffw.app.AppManager;
import com.fanfanwang.ffw.app.R;
import com.fanfanwang.ffw.app.adapter.ZhiHangListAdapter;
import com.fanfanwang.ffw.app.asynctask.SaveFeedbackAsyncTask;
import com.fanfanwang.ffw.app.bean.ServiceBean;
import com.fanfanwang.ffw.app.common.ToastAlone;
import com.fanfanwang.ffw.app.tools.SharedPreferencesUtil;
import com.fanfanwang.ffw.app.widget.CommonTitleBar;

/** 建议*/
public class ServiceAdviceAct extends com.fanfanwang.ffw.app.base.BaseActivity {

	private CommonTitleBar commonTitleBar;
	private Activity mAct;
	private Intent mIntent;
	private Button submit_btn;
	private EditText et_advice;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		initWidget();
		initData();
		AppManager.getAppManager().addActivity(this);
		widgetClick();
	}

	public void initWidget() {
		setContentView(R.layout.activity_advice);
		mAct = this;
		commonTitleBar = (CommonTitleBar) findViewById(R.id.common_titlebar);
		et_advice=(EditText)findViewById(R.id.et_advice);

	}

	public void widgetClick() {
		commonTitleBar.setToolBarReturnOnclickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				finish();
			}
		});
		submit_btn.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				if(!TextUtils.isEmpty(et_advice.getText().toString())){
					String userid=SharedPreferencesUtil.getInstance(mAct).getUserId();
					if(!TextUtils.isEmpty(userid))
					{
						new SaveFeedbackAsyncTask(mAct,userid, et_advice.getText().toString()).execute("");
					}else{
						ToastAlone.showToast(mAct, getString(R.string.toast_submit_advice));
					}
					finish();
				}else{
					ToastAlone.showToast(mAct, getString(R.string.toast_submit_advice_not_null));
				}
				
			}
		});
	}

	@Override
	public void initData() {
		commonTitleBar.setCenterText(getString(R.string.advice_title));
		commonTitleBar.setReturnVisible();
		submit_btn=(Button)findViewById(R.id.btn_submit);
	}


	@Override
	protected void initView() {

	}

	@Override
	protected void setListener() {

	}
}
